package com.nowcoder;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class FindBrotherWord {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextLine()) {
            String line = scanner.nextLine();
            solver(line);
        }
    }

    public static void solver(String line) {
        String[] strs = line.split(" ");
        int n = Integer.valueOf(strs[0]);
        String[] arr = new String[n];
        for (int i = 0; i < n; i++) {
            arr[i] = strs[i+1];
        }
        String findStr = strs[n+1];
        int k = Integer.valueOf(strs[n+2]);
        // 计数单词数组中各个单词的字符计数
        int[][] matrix = new int[n][26];
        for (int i = 0; i < n; i++) {
            String str = arr[i];
            for (int j = 0; j < str.length(); j++) {
                matrix[i][arr[i].charAt(j)-'a']++;
            }
        }
        // 计数待查找单词中各个字符的个数
        int[] pattern = new int[26];
        for (int i = 0; i < findStr.length(); i++) {
            pattern[findStr.charAt(i)-'a']++;
        }
        // 使用模式单词与单词数组中所有的单词进行对比，若是某个单词的各个字符计数与模式
        // 单词中各个字符计数相同，说明该单词就是兄弟单词，并存入结果链表中
        List<String> resList = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int j;
            for (j = 0; j < 26; j++) {
                if(matrix[i][j] != pattern[j]) {
                    break;
                }
            }
            if(j == 26 && !findStr.equals(arr[i])) {
                resList.add(arr[i]);
            }
        }
        // 打印输出兄弟单词的个数
        System.out.println(resList.size());
        List<String> sorteResList = resList.stream()
                .sorted()
                .collect(Collectors.toList());
        if(k <= sorteResList.size()) {
            System.out.println(sorteResList.get(k-1));
        }
    }
}
